import store from '@/store';
import {
    getUserInfoRemoteService,
    updateUserInfoService,
    submitDeliveryService
} from '../service';

/**
 * 从数据库获取已存的用户信息
 */
export async function getUserInfoRemote(payload = {}) {
    const allData = await getUserInfoRemoteService(payload);
    if (allData.code >= 2000 && allData.code < 4000) {
        store.commit('setUserInfo', allData.data); // 将获取到的数据值存到store中
    }
    return allData;
}

/**
 * 更新用户个人信息,返回成功失败信息
 */
export async function updateUserInfo(payload = {}) {
    const allData = await updateUserInfoService(payload);
    return allData;
}

/**
 * 报名职位
 */
export async function submitDelivery(payload = {}) {
    const allData = await submitDeliveryService(payload);
    return allData;
}